
import { createRouter, createWebHashHistory } from 'vue-router'
import DashboardPage from "@/page/dashboard/DashboardPage.vue";

const routes = [
    {
        path: '/',
        redirect: '/dashboard',
    },
    {
        path: '/dashboard',
        component: () => import("@/page/dashboard/DashboardPage.vue"),
        meta: {
            auth: true
        }
    }
]

const adminRouter = createRouter({
    history: createWebHashHistory(),
    routes,
})

// 路由守护
adminRouter.beforeEach((to, from, next) => {
    console.log('router before each: to = ', to.path);
    console.log('router before each: from = ', to.redirectedFrom);
    next();
})


export default adminRouter